function http(url, params) {
    // 基准地址
    const baseUrl = 'https://api-hmugo-web.itheima.net/api/public/v1/'
    // 开启loading
    wx.showLoading({
        title: '加载中',

    })
    return new Promise((resolve, reject) => {
        wx.request({
            ...params,
            url: baseUrl + url,
            header: {
                'Authorization': wx.getStorageSync('token') // 默认值
            },
            success(res) {
                resolve(res.data)
            },
            fail(error) {
                reject(error)
            },
            complete() {
                // 关闭loading
                wx.hideLoading()
            }
        })
    })
}


export default http